package cn.sunshine.ymcc.fegin;

import cn.sunshine.ymcc.CourseDoc;
import cn.sunshine.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class FallbackFactorySearchFeign implements FallbackFactory<SearchFeign> {
    @Override
    public SearchFeign create(Throwable throwable) {
        return new SearchFeign() {
            @Override
            public JSONResult saveCourse(CourseDoc doc) {
                throwable.printStackTrace();
                return JSONResult.error("发布课程失败");
            }

            @Override
            public JSONResult delete(Long id) {
                throwable.printStackTrace();
                return JSONResult.error("下架课程失败");
            }
        };
    }
}
